import { App } from "vue";

export const regDebounce = (app: App<Element>) => {
    app.directive("debounce", {
        mounted(el, binding) {
            let timer: any;
            el.addEventListener("click", () => {
                clearTimeout(timer);
                timer = setTimeout(() => {
                    // 延迟执行的代码
                    binding.value();
                }, 1000);
            });
        },
    });
};